package win.larryzeal.spring.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import win.larryzeal.spring.except.UnauthenticatedException;

/**
 * @author LarryZeal
 *
 */
@RestController
@RequestMapping("/demo")
public class DemoHandler {

	@RequestMapping("/1")
	public String demo1(String key) throws UnauthenticatedException{
		if("y".equals(key))
			throw new UnauthenticatedException();
		else
			return "1 what the f**k";
	}
	@RequestMapping("/2")
	public String demo2(String key) throws Exception{
		if("y".equals(key))
			throw new Exception();
		else
			return "2 what the f**k";
	}
}
